<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<meta name="force-rendering" content="webkit"/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
<script>/*@cc_on window.location.href="http://support.dmeng.net/upgrade-your-browser.html?referrer="+encodeURIComponent(window.location.href); @*/</script>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        html,body{
            width:100%; height:100%;
        }
        body{
            overflow: hidden;
            background: transparent;
        }
        iframe{
            width:100%;
            height:100%;
            overflow: hidden;
            border:none;
        }
        .J_iframe{display:none;}
        .J_iframe.on{
            display: block !important;
        }
        #myframe{
            width: calc(100% - 15px);
        }
    </style>
</head>
<body>

<iframe id="myframe" src=""></iframe>
<a id="basePath" th:href="@{/}"></a>
<script src="../../../assert/js/jquery.js" th:src="@{/assert/js/jquery.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/tagContab.js" th:src="@{/assert/js/tagContab.js}"></script>
<script type="text/javascript">
    var basePath = $("#basePath").attr("href");
    $.ajax({
        type: "get",
        url: basePath + "rest/tagManager/getTagAddress",
        data: {},
        success: function (data) {
            if (data.msg != "") {
                var myframe = document.getElementById('myframe');
                var dbasePath=basePath;
                myframe.setAttribute("src",data.msg+"/rest/page/auditAudio");
                window.addEventListener('message',function(e){
                    var username=sessionStorage.getItem("spanId");
                    var seatId=sessionStorage.getItem("seatId");
                    var proCode=sessionStorage.getItem("procode");
                    var areaId=sessionStorage.getItem("areaId");
                    if(e.data.msg==='loaded'){
                        //传入子页面信息
                        myframe.contentWindow.postMessage({data:{
                                username:username,
                                seatId:seatId,
                                proCode:proCode,
                                areaId:areaId,
                                dbasePath:dbasePath
                            }},e.data.url);
                    }else if(e.data.msg=='click'){
                        var o=e.data.data.datahref;
                        var m=e.data.data.dataindex;
                        // myframe.setAttribute("src",o);
                        $(".J_menuTab",window.parent.document).removeClass("active");
                        var p = '<a href="javascript:void(0)" class="active J_menuTab qJ_menuTab" data-class="qJ_menuTab" data-id="' + o + '" data-index="'+m+'">' +  e.data.data.datatxt  + ' <i class="fa fa-times-circle"></i></a>';
                        $(".J_menuTabs .page-tabs-content",window.parent.document).append(p); //增加tab
                        if($(".J_menuTabs .page-tabs-content  a[data-class='qJ_menuTab']",window.parent.document).length>1){
                            $(".J_menuTabs .page-tabs-content  a[data-class='qJ_menuTab']",window.parent.document).remove();
                            $(".J_menuTabs .page-tabs-content",window.parent.document).append(p); //增加tab
                        }
                        if($("iframe[name='iframe"+m+"']",window.parent.document).length>0){
                            $("iframe[name='iframe"+m+"']",window.parent.document).remove();
                        }
                        var n = '<iframe class="J_iframe on" name="iframe' + m + '" width="100%" height="100%"  data-index="'+m+'" src="' + o + '" frameborder="0" data-id="' + o + '" ></iframe>';
                        $(".J_mainContent",window.parent.document).find("iframe.J_iframe").hide();
                        $(".J_mainContent",window.parent.document).append(n);
                        $(".J_menuTabs",window.parent.document).on("click",".J_menuTab",function(){
                            window.location.reload();
                        });
                    }
                });
            }
        }

    });
</script>
</body>
</html>